﻿#include "mainwindow.h"
#include <QApplication>
#include <QFile>
#include <QTextCodec>
#undef main

int main(int argc, char *argv[])
{
    QApplication a(argc, argv);
    MainWindow w;

    //设置中文编码
#if (QT_VERSION <= QT_VERSION_CHECK(5,0,0))
#if _MSC_VER
    QTextCodec *codec = QTextCodec::codecForName("GBK");
#else
    QTextCodec *codec = QTextCodec::codecForName("UTF-8");
#endif
    QTextCodec::setCodecForLocale(codec);
    QTextCodec::setCodecForCStrings(codec);
    QTextCodec::setCodecForTr(codec);
#else
    QTextCodec *codec = QTextCodec::codecForName("UTF-8");
    QTextCodec::setCodecForLocale(codec);
#endif

    // 加载QSS文件
    QFile file(":/Image/darkTheme.qss");
    file.open(QFile::ReadOnly);
    QString styleSheet = QLatin1String(file.readAll());
    a.setStyleSheet(styleSheet);

    QFont font("Microsoft YaHei", 12); // 以微软雅黑为例
    a.setFont(font); // 设置应用程序的字体

    w.show();
    return a.exec();

}
